\documentclass{ctexart}

\usepackage{graphicx}
\usepackage{float}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,chains}

\title{一元二次方程在实数域上的求解}

\author{周游 \\ 强基数学3200106105}

\date{2022/7/3}

\begin{document}

\maketitle

\section*{}

求解一元二次方程$ax^2+bx+c=0$在实数域上的解，
令$\Delta=b^2-4ac$为根的判别式。\par
$\Delta>0$时，有两个不等实根$x_1=\frac{-b+\sqrt{\Delta}}{2a},
x_2=\frac{-b-\sqrt{\Delta}}{2a}$。\par
$\Delta=0$时，有两个相等实根$x_1=x_2=-\frac{b}{2a}$。\par
$\Delta<0$时，无实根。

\begin{figure}[H]
    \centering
    \input{case1}
    \caption{$\Delta > 0$时}
    \label{great}
\end{figure}

\begin{figure}[H]
    \centering
    \input{case2}
    \caption{$\Delta = 0$时}
    \label{equ}
\end{figure}

\begin{figure}[H]
    \centering
    \input{case3}
    \caption{$\Delta < 0$时}
    \label{less}
\end{figure}

\newpage
算法流程图如下:

\begin{figure}[H]
    \centering
\thispagestyle{empty}
% 流程图定义基本形状
\tikzstyle{startstop} = [rectangle, rounded corners, minimum width = 2cm, minimum height=1cm,text centered, draw = black]
\tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=2cm, minimum height=1cm, text centered, draw=black]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black]
\tikzstyle{decision} = [diamond, aspect = 3, text centered, draw=black]
% 箭头形式
\tikzstyle{arrow} = [->,>=stealth]
\begin{tikzpicture}[node distance=0.5cm]
%定义流程图具体形状
\node[startstop](start){开始};
\node[io, below of = start, yshift = -1cm](in1){输入a,b,c};
\node[process, below of = in1, yshift = -1cm](pro1){$\Delta = b^2-4ac$};
\node[decision, below of = pro1, yshift = -1cm](dec1){$\Delta \geqslant 0$?};
\node[process, below of = dec1, yshift = -1cm](pro2){$p=-\frac{b}{2a}$};
\node[io, right of = pro2, xshift = 4cm](out2){无实根};
\node[decision, below of = pro2, yshift = -1cm](dec2){$\Delta = 0$?};
\node[process, below of = dec2, yshift = -1cm](pro3){$q=\frac{\sqrt{\Delta}}{2a}$};
\node[process, below of = pro3, yshift = -1cm](pro4){$m = p + q$};
\node[process, below of = pro4, yshift = -1cm](pro5){$n = p - q$};
\node[io, below of = pro5, yshift = -1cm](out1){输出m,n};
\node[io, left of = pro3, xshift = -4cm](out3){输出p};
\node[startstop, below of = out1, yshift = -1cm](stop){结束};
%\coordinate (point1) at (3cm, 6cm);
%\coordinate (point2) at (-3cm, -6cm);

%连接具体形状
\draw [arrow] (start) -- (in1);
\draw [arrow] (in1) -- (pro1);
\draw [arrow] (pro1) -- (dec1);
\draw (dec1) -| node [above] {否} (out2);
\draw (dec1) -- node [right] {是} (pro2);
\draw [arrow] (pro2) -- (dec2);
\draw (dec2) -- node [right] {否} (pro3);
\draw [arrow] (pro3) -- (pro4);
\draw [arrow] (pro4) -- (pro5);
\draw [arrow] (pro5) -- (out1);
\draw [arrow] (out1) -- (stop);
\draw (dec2) -| node [above] {是} (out3);
\draw [arrow] (out2) |- (stop);
\draw [arrow] (out3) |- (stop);

\end{tikzpicture}
\caption{算法流程图}
\label{process}
\end{figure}

%\input{case1}
%\input{case2}
%\input{case3}

\end{document}